package com.paper.tiger.easy.rpc.s.client.handler;

import com.paper.tiger.easy.rpc.core.kryo.KryoSerializer;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;

import java.util.List;

/**
 * 解码器
 */
@ChannelHandler.Sharable
public class KryoDoveDecoder extends MessageToMessageDecoder<ByteBuf> {


    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {

        Object obj = KryoSerializer.deserialize(in);
        out.add(obj);

    }
}
